<?php
$params = array_merge(
    require(__DIR__ . '/../../common/config/params.php'),
    require(__DIR__ . '/../../common/config/params-local.php'),
    require(__DIR__ . '/params.php'),
    require(__DIR__ . '/params-local.php')
);

return [
    'id' => 'ua_backend',
    'name' => 'UA Retail',
    'basePath' => dirname(__DIR__),
    'controllerNamespace' => 'ua_backend\controllers',
    'language'  => 'zh-CN',
    'modules' => [
        "ctl" => ["class" => "mdm\admin\Module"],
        'gridview' =>  [
            'class' => '\kartik\grid\Module',
        ],
    ],
    'aliases' => [
        "@mdm/admin" => "@vendor/mdmsoft/yii2-admin",
        '@Psr/SimpleCache' => '@vendor/psr/simple-cache/src',
        '@PhpOffice' => '@vendor/phpoffice',
        '@bower' => '@vendor/bower-asset',
        '@npm'   => '@vendor/npm-asset',
    ],

    'components' => [
        'request' => [
            'csrfParam' => 'csrfUABackend',
        ],
        'user' => [
            'identityClass' => 'ua_backend\models\Admin',
            'enableAutoLogin' => true,
            'identityCookie' => ['name' => '_ua-backend', 'httpOnly' => true],
        ],
        'session' => [
            'name' => 'yiiUaBackend',
        ],

        'errorHandler' => [
            'errorAction' => 'site/error',
        ],

        'urlManager' => [
            'enablePrettyUrl' => true,
            'showScriptName' => false,
            'suffix' => '',
            'rules' => [
                "<controller:\w+>/<id:\d+>"=>"<controller>/view",
                "<controller:\w+>/<action:\w+>"=>"<controller>/<action>"
            ],
        ],


        'i18n' => [
            'translations' => [
                'app' => [
                    'class' => 'yii\i18n\DbMessageSource',
                    'sourceLanguage' => 'en'
                ],
                'yii' => [
                    'class' => 'yii\i18n\DbMessageSource',
                    'sourceLanguage' => 'en',
                ],
                'kveditable' => [
                    'class' => 'yii\i18n\DbMessageSource',
                    'sourceLanguage' => 'en',
                ],
                'menu' => [
                    'class' => 'yii\i18n\DbMessageSource',
                    'sourceLanguage' => 'en',
                ],
            ],
        ],

    ],


    'as access' => [
        'class' => 'mdm\admin\components\AccessControl',
        'allowActions' => [
            '*',
        ]
    ],
    'params' => $params,
];
